package com.by.springbootbanner.controller;

import com.by.springbootbanner.utils.ImageToASCIIUtil;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping(value = "/image2ascii")
public class ImageToASCIIController {

    @PostMapping(value = "/create")
    public String create(@RequestParam MultipartFile file) {
        try {
            return ImageToASCIIUtil.imageToASCII(file.getInputStream());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

}
